package com.video.video.service.impl;

import com.video.common.utils.uuid.IdUtils;
import com.video.video.domain.dto.DCommissionRecordDto;
import com.video.video.domain.vo.DCommissionRecordQuery;
import java.util.List;
import com.video.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.video.video.mapper.DCommissionRecordMapper;
import com.video.video.domain.DCommissionRecord;
import com.video.video.service.IDCommissionRecordService;

/**
 * 返佣记录Service业务层处理
 *
 * @author ruoyi
 * @date 2022-09-27
 */
@Service
public class DCommissionRecordServiceImpl implements IDCommissionRecordService
{
    @Autowired
    private DCommissionRecordMapper dCommissionRecordMapper;

    /**
     * 查询返佣记录
     *
     * @param id 返佣记录主键
     * @return 返佣记录
     */
    @Override
    public DCommissionRecord selectDCommissionRecordById(String id)
    {
        return dCommissionRecordMapper.selectDCommissionRecordById(id);
    }

    /**
     * 查询返佣记录列表
     *
     * @param query 返佣记录
     * @return 返佣记录
     */
    @Override
    public List<DCommissionRecordDto> selectDCommissionRecordList(DCommissionRecordQuery query)
    {
        return dCommissionRecordMapper.selectDCommissionRecordList(query);
    }

    @Override
    public List<DCommissionRecord> selectVipRecordList(DCommissionRecord dCommissionRecord) {
        return dCommissionRecordMapper.selectVipRecordList(dCommissionRecord);
    }

    /**
     * 新增返佣记录
     *
     * @param dCommissionRecord 返佣记录
     * @return 结果
     */
    @Override
    public int insertDCommissionRecord(DCommissionRecord dCommissionRecord)
    {
        dCommissionRecord.setId(IdUtils.getId());
        dCommissionRecord.setCreateTime(DateUtils.getNowDate());
        return dCommissionRecordMapper.insertDCommissionRecord(dCommissionRecord);
    }

    /**
     * 修改返佣记录
     *
     * @param dCommissionRecord 返佣记录
     * @return 结果
     */
    @Override
    public int updateDCommissionRecord(DCommissionRecord dCommissionRecord)
    {
        dCommissionRecord.setUpdateTime(DateUtils.getNowDate());
        return dCommissionRecordMapper.updateDCommissionRecord(dCommissionRecord);
    }

    /**
     * 批量删除返佣记录
     *
     * @param ids 需要删除的返佣记录主键
     * @return 结果
     */
    @Override
    public int deleteDCommissionRecordByIds(String[] ids)
    {
        return dCommissionRecordMapper.deleteDCommissionRecordByIds(ids);
    }

    /**
     * 删除返佣记录信息
     *
     * @param id 返佣记录主键
     * @return 结果
     */
    @Override
    public int deleteDCommissionRecordById(String id)
    {
        return dCommissionRecordMapper.deleteDCommissionRecordById(id);
    }
}
